package com.mm.mindmap.handler;

import cn.hutool.core.util.StrUtil;
import com.mm.common.pipeline.PipelineHandler;
import com.mm.common.pipeline.Product;
import com.mm.common.utils.DataUtil;
import com.mm.mindmap.domain.po.MindMap;

public class CheckParam extends PipelineHandler {

    @Override
    public Product process(Product product) {
        MindMap mindMap = product.getData(MindMap.class);
        if(mindMap == null
                || DataUtil.isNaturalNumInvalid(mindMap.getId())
                || StrUtil.isBlank(mindMap.getTitle())
                || StrUtil.isBlank(mindMap.getNodeList())){
            return Product.getAbnormal("参数检验失败");
        }
        return product;
    }
}
